#include "MiniGameSelect.h"
#include "GameMapSelect.h"
#include "../Game.h"
#include "../SGD Wrappers\SGD_InputManager.h"
#include "GameState.h"
#include "MainMenuState.h"
#include "GameMode.h"
#include "DodgeBomb.h"

CMiniGameSelect* CMiniGameSelect::GetInstance(void)
{
	static CMiniGameSelect s_Instance;
	return &s_Instance;
}

void CMiniGameSelect::Enter(void)
{
	map1 = SGD::GraphicsManager::GetInstance()->LoadTexture("pictures/map1.png");

}

void CMiniGameSelect::Exit(void)
{
	SGD::GraphicsManager::GetInstance()->UnloadTexture(map1);

}

bool CMiniGameSelect::Input(void)
{
	SGD::InputManager* pInput = SGD::InputManager::GetInstance();

	if (pInput->IsKeyPressed(SGD::Key::Escape) == true || pInput->IsButtonPressed(0, 1) == true)
	{
		Game::GetInstance()->ChangeState(CGameMode::GetInstance());
		return true;
	}

	if (pInput->IsKeyPressed(SGD::Key::Enter) == true || pInput->IsButtonPressed(0, 0))
	{
		Game::GetInstance()->ChangeState(CDodgeBomb::GetInstance());
		return true;
	}
	return true;
}

void CMiniGameSelect::Update(float elapsedTime)
{}

void CMiniGameSelect::Render(void)
{
	const Font* pFont = Game::GetInstance()->GetFont();

	Game* pGame = Game::GetInstance();

	float darkOffset = pGame->DarkOff();
	float medOffset = pGame->MedOff();
	float lightOffset = pGame->LightOff();

	SGD::GraphicsManager::GetInstance()->DrawTexture(pGame->GetDarkSmoke(), { darkOffset, 0 }, 0.0f, { 0, 0 }, { 110, 255, 255, 255 });
	SGD::GraphicsManager::GetInstance()->DrawTexture(pGame->GetMedSmoke(), { medOffset, 0 }, 0.0f, { 0, 0 }, { 127, 255, 255, 255 });
	SGD::GraphicsManager::GetInstance()->DrawTexture(pGame->GetLightSmoke(), { lightOffset, 0 }, 0.0f, { 0, 0 }, { 135, 255, 255, 255 });

	SGD::GraphicsManager::GetInstance()->DrawTexture(pGame->GetDarkSmoke(), { darkOffset - 805, 0 }, 0.0f, { 0, 0 }, { 110, 255, 255, 255 });
	SGD::GraphicsManager::GetInstance()->DrawTexture(pGame->GetMedSmoke(), { medOffset - 805, 0 }, 0.0f, { 0, 0 }, { 127, 255, 255, 255 });
	SGD::GraphicsManager::GetInstance()->DrawTexture(pGame->GetLightSmoke(), { lightOffset - 805, 0 }, 0.0f, { 0, 0 }, { 135, 255, 255, 255 });

	pFont->Draw("Mini Game Select", { 1, 1 }, 1, { 255, 255, 255 });
	SGD::GraphicsManager::GetInstance()->DrawTextureSection(map1, { 20, 200 }, SGD::Rectangle{ 0, 0, 800, 600 }, 0.0f, {}, { 255, 255, 255 }, { 0.4f, 0.4f });
	pFont->Draw("This is our \nbasic map\n\nThe Dodge Bomb\n Mini Game\nis Dodge ball...\nWITH BOMBS!", { 360, 220 }, 0.5f, { 255, 255, 255 });

}
